<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: test   array.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1316139452.06" />
	<link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1316139452.06" />

    <script type="text/javascript" src="assets/api-js?stamp=1316139452.06"></script>
    <script type="text/javascript" src="assets/ac-js?stamp=1316139452.06"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="g-javascript-lib">g-javascript-lib</a></h1>
        <h3>test&nbsp; <span class="subtitle">1.0.0</span></h3>
        <a href="./index.html" title="g-javascript-lib">g-javascript-lib</a> 
            &gt; <a href="./module_test.html" title="test">test</a>
                
                 &gt; array.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
<div class="highlight"><pre> 
<span class="cm">/**</span>
<span class="cm"> * Add insertAt and removeAt to javascript&#39;s array.</span>
<span class="cm"> * @module utils</span>
<span class="cm"> * @class Array</span>
<span class="cm"> */</span>
<span class="p">(</span><span class="kd">function</span><span class="p">(){</span>
	<span class="cm">/**</span>
<span class="cm">	 * Insert a new element to array</span>
<span class="cm">	 * @method insertAt</span>
<span class="cm">	 */</span>
	<span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">insertAt</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">index</span><span class="p">,</span> <span class="nx">value</span> <span class="p">)</span>
	<span class="p">{</span>
		<span class="kd">var</span> <span class="nx">part1</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">index</span> <span class="p">);</span>
		<span class="kd">var</span> <span class="nx">part2</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span> <span class="nx">index</span> <span class="p">);</span>
		<span class="nx">part1</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span> <span class="nx">value</span> <span class="p">);</span>
		
		<span class="k">return</span><span class="p">(</span><span class="nx">part1</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span> <span class="nx">part2</span> <span class="p">));</span>
	<span class="p">};</span>
	
	<span class="cm">/**</span>
<span class="cm">	 * Remove an element in array</span>
<span class="cm">	 * @method removeAt</span>
<span class="cm">	 */</span>
	<span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">removeAt</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">index</span><span class="p">)</span>
	<span class="p">{</span>
		<span class="kd">var</span> <span class="nx">part1</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="nx">index</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
		<span class="kd">var</span> <span class="nx">part2</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">index</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
		<span class="nx">part1</span><span class="p">.</span><span class="nx">pop</span><span class="p">();</span>
		<span class="k">return</span><span class="p">(</span> <span class="nx">part1</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span> <span class="nx">part2</span> <span class="p">)</span> <span class="p">);</span>
	<span class="p">}</span>
<span class="p">}</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_base.html" title="base">base</a></li>
                                <li class=""><a href="module_svg.html" title="svg">svg</a></li>
                                <li class="selected"><a href="module_test.html" title="test">test</a></li>
                                <li class=""><a href="module_utils.html" title="utils">utils</a></li>
                                <li class=""><a href="module_widget.html" title="widget">widget</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="Test.TestBox.html" title="Test.TestBox">Test.TestBox</a></li>
                                <li class=""><a href="Test.TestCase.html" title="Test.TestCase">Test.TestCase</a></li>
                                <li class=""><a href="Test.TestSuit.html" title="Test.TestSuit">Test.TestSuit</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class="selected"><a href="array.js.html" title="array.js">array.js</a></li>
                                <li class=""><a href="testbox.js.html" title="testbox.js">testbox.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2011 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">
    ALL_YUI_PROPS = [{"url": "Test.TestSuit.html#method_add_case", "access": "", "host": "Test.TestSuit", "type": "method", "name": "add_case"}, {"url": "Test.TestCase.html#method_assert", "access": "", "host": "Test.TestCase", "type": "method", "name": "assert"}, {"url": "Test.TestCase.html#method_assert_equ", "access": "", "host": "Test.TestCase", "type": "method", "name": "assert_equ"}, {"url": "Test.TestSuit.html#method_clear_msg", "access": "", "host": "Test.TestSuit", "type": "method", "name": "clear_msg"}, {"url": "Test.TestSuit.html#method_err", "access": "", "host": "Test.TestSuit", "type": "method", "name": "err"}, {"url": "Test.TestSuit.html#method___init", "access": "", "host": "Test.TestSuit", "type": "method", "name": "__init"}, {"url": "Test.TestCase.html#method___init", "access": "", "host": "Test.TestCase", "type": "method", "name": "__init"}, {"url": "Test.TestSuit.html#method_init_console", "access": "", "host": "Test.TestSuit", "type": "method", "name": "init_console"}, {"url": "Test.TestBox.html#method_load_page", "access": "", "host": "Test.TestBox", "type": "method", "name": "load_page"}, {"url": "Test.TestSuit.html#method_log", "access": "", "host": "Test.TestSuit", "type": "method", "name": "log"}, {"url": "Test.TestSuit.html#method_run", "access": "", "host": "Test.TestSuit", "type": "method", "name": "run"}];
</script>
</body>
</html>
